home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12065 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  36 lines

  1. Path: news.clark.net!not-for-mail
  2. From: gusty@clark.net (Harlan Messinger)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: extern consts
  5. Date: 18 Mar 1996 04:02:57 GMT
  6. Organization: Clark Internet Services, Inc., Ellicott City, MD USA
  7. Message-ID: <4iin9h$fdk@clarknet.clark.net>
  8. References: <4idbcv$ue2@news7.erols.com> <314c2077.138956468@nntp.ix.netcom.com> <4ii7h9$bq6@news6.erols.com>
  9. NNTP-Posting-Host: explorer.clark.net
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=ISO-8859-1
  12. Content-Transfer-Encoding: 8bit
  13. X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
  14.  
  15. Chris Cobb (ccobb@cseg.com) wrote:
  16. : miker3@ix.netcom.com (Mike Rubenstein) wrote:
  17. : >
  18. : >It's not legal.  extern const is legal, but in any compilation unit
  19. : >that does not see the initializer the const variable is not a constant
  20. : >expression.
  21. : >
  22. : Well, your comment makes sense.  However, in a way it seem 
  23. : self-contradictory.  If a const can be extern, then it no longer is a 
  24. : const: you've basically externed away constness.  
  25.  
  26. Huh? The word "const" means, fundamentally, "cannot be changed once 
  27. initialized". This holds just as true for an externally defined const as 
  28. any other. If you try the following in a module:
  29.  
  30.     extern const int iConst;
  31.     iConst = 5;
  32.  
  33. it won't compile. So what do you mean by, "it no longer is a const"?
  34.  
  35.